var basepath="http://47.100.197.8";
function yunshu(){

    var params={
        "username":user.code,
        "password":yunshupd,
        "corpId":"main",
        "url":"http://47.100.197.8/api/login?redirect_uri=http://47.100.197.8/api/oauth/authorize?client_id=api&response_type=code&scope=read&redirect_uri=http://47.100.197.8/oauth"
    }
    $.ajax({
        url:basepath+'/api/login/Authentication/get_code',
        type:"POST",
        dataType: "json",
        contentType: 'application/json',
        data:JSON.stringify(params),
        success:function(data){
            if(data.errcode==200){
                gettoken(data.code)
            }
        }
    })

}
function gettoken(p){
    ///api/login/Authentication/get_token
    var params={
        url:"http://47.100.197.8/api",
    code:p,
    client_secret:"c31b32364ce19ca8fcd150a417ecce58",
    client_id:"api",
    redirect_uri:"http://47.100.197.8/oauth"
    }
    $.ajax({
        url:basepath+'/api/login/Authentication/get_token',
        type:"GET",
        dataType: "json",
        contentType: 'application/x-www-form-urlencoded',
        data:params,
        success:function(data){

          // location.href="http://47.100.197.8?access_token="+data.access_token;
            window.open("http://47.100.197.8?access_token="+data.access_token);

        }
    })
}
